package com.xiangge.schedules;

import com.xiangge.crawler.inter.CrawlerBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;
import java.util.UUID;

/**
 * @author lsy_server
 */
@Component
public class CrawlerJob {
    @Autowired
    private List<CrawlerBaseService> serviceList;

    //@Scheduled(cron = "0 0 1 * * ?")
    @PostConstruct
    public void crawler() {
        try {
            if (serviceList.size() > 0) {
                serviceList.forEach(
                        CrawlerBaseService::crawler
                );
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        String replace = UUID.randomUUID().toString().replace("-", "");
        System.out.println(replace.length());
        System.out.println(replace);
    }
}
